package com.egao.api.controller.orderB;


import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.service.OperRecordService;
import com.egao.orderB.entity.Bill;
import com.egao.orderB.entity.WriteOff;
import com.egao.orderB.service.BillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * api登录相关接口
 * Created by wangfan on 2019-05-29 下午 3:43.
 * http://localhost/swagger-ui.html
 * https://francjc.com:4332/swagger-ui.html
 */
@RequestMapping("/api/bill")
@RestController
@Api(value = "订单管理",tags = {"订单管理"})
public class ApiBillController extends BaseController {

    @Autowired
    private OperRecordService operRecordService;
    @Autowired
    private BillService billService;

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/list2")
    @ApiOperation(value = "表格订单列表 为了导出抬头使用,重新写了这么个方法",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "customer  货代名称\n" +
            "contacts  联系人\n" +
            "billOfLading  提单号\n" +
            "vessel  船名\n" +
            "voyage  航次\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "boxNum  箱号\n" +
            "factoryAddress  工厂地址\n" +
            "arrivalPort  进港码头\n" +
            "upYard 提箱堆场\n" +
            "whiteCard  白卡号\n" +
            "province  地址查询\n" +
            "dropBox;是否落箱 0没有落箱 1落箱了\n" +
            "withholding: 是否预提 0没有预提  1预提了\n" +
            "cash: 是否现金 0不是现金  1现金车\n" +
            "salesman;业务员\n" +
            "operater;操作\n" +
            "state  状态  参数传 '进行中' 返回'已做单','已指派车队','已提箱','已到厂','已离厂','已进港'的订单\n" +
            "参数传 '结算' 返回'发起费用清单','应付费用已审核','应收费用审核','财务应收应付费用已审核','结单'的订单\n" +
            "其他正常传值\n" +
            "feeTotalS  参数传: 'List_some_state' 这个值就可以得到keywords之后状态的订单\n" +
            "keywords  参数传: 订单某个开始状态:发起费用清单,货代费用已审核等等\n" +
            "feeTotalF  参数传: 不在流程的某个状态 比如待发起账单传:发起费用清单 返回结果为 没有'发起费用清单'这个状态的运单 \n" +
            "checked  未收款:运单还没有收款单 \n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            "sort  值为customer_id时 先以客户名称排序,再以装箱时间排序\n" +
            " \n\n\n" +
            "返回的结果:\n" +
            "id int id\n" +
            "organization_id varchar 组织id\n" +
            "customerId varchar 货代名称id\n" +
            "customer varchar 货代名称\n" +
            "email varchar email\n" +
            "contacts varchar 联系人\n" +
            "contacts_phone varchar 联系电话\n" +
            "dock varchar 码头\n" +
            "province varchar 工厂地址\n" +
            "address varchar 详细地址\n" +
            "weight varchar 箱门重量\n" +
            "box_type varchar 箱型\n" +
            "price varchar 价格\n" +
            "barcodeEffectiveDate varchar 最晚提箱时间/条码有效时间\n" +
            "earliestArrivalPortDate varchar 最早进港时间\n" +
            "pack_date varchar 装箱日期(货代要求的装箱时间)\n" +
            "vessel varchar 船名\n" +
            "voyage varchar 航次\n" +
            "whiteCard varchar 白卡号\n" +
            "bill_of_lading varchar 提单号\n" +
            "factory_address varchar 工厂地址\n" +
            "factory_phone varchar 装箱人电话\n" +
            "qr_code varchar 二维码\n" +
            "car_team varchar 车队\n" +
            "driverId 司机id\n" +
            "driver varchar 司机\n" +
            "driver_phone varchar 司机电话\n" +
            "sysDriverFreight varchar 系统司机运费\n" +
            "car_no varchar 车牌\n" +
            "driver_freight varchar 运费\n" +
            "box_num varchar 箱号\n" +
            "box_num_pic varchar 箱号图片\n" +
            "sealno varchar 封号\n" +
            "sealno_pic varchar 封号图片\n" +
            "arrived_factory_latitude varchar 到厂纬度\n" +
            "arrived_factory_longitude varchar 到厂经度\n" +
            "arrived_factory_date varchar 到厂时间\n" +
            "arrived_factory_warn_date varchar 到厂预警时间(默认提前一小时)\n" +
            "leaved_factory_date varchar 离厂时间\n" +
            "leaved_factory_longitude varchar 离厂经度\n" +
            "leaved_factory_latitude varchar 离厂纬度\n" +
            "arrived_harbour_date varchar 到港时间\n" +
            "arrived_harbour_latitude varchar 到港纬度\n" +
            "arrived_harbour_longitude varchar 到港经度\n" +
            "arrived_harbour_warn_date varchar 到港预警时间(默认提前一小时)\n" +
            "annex 附件\n" +
            "annexList 附件 没有实际用处\n" +
            "state varchar 状态:已下单,平台已接单,已做单,已提箱,已到厂,已离厂,已进港,发起费用清单,司机费用已审核,货代费用已提交,货代费用已审核,货代费用未通过,货代费用已提交,货代费用未通过,货代费用已审核,结单\n" +
            "carState;车辆状态:出行中,待出行 这几个状态的订单为出行中:已指派车队,已做单,已提箱,已到厂,已离厂,已进港\n" +
            "offertime:下单时间\n" +
            "maketime:做单时间\n" +
            "driverreceivetime:司机接单时间\n" +
            "upboxtime:提箱时间\n" +
            "arrivedfactorytime:到厂时间\n" +
            "leavefactorytime:离场时间\n" +
            "inporttime:进港时间\n" +
            "costbilltime:发起费用清单时间\n" +
            "verifytime:货代费用审核时间\n" +
            "driverFeeVerifytime:司机费用审核时间\n" +
            "customerverifytime:货代确认时间\n" +
            "upYard:提箱堆场\n" +
            "backYard:还箱堆场\n" +
            "billFeeList:费用信息\n" +
            "billProcessList:费用流程\n" +
            "arrivalPort:进港码头\n" +
            "sealedLand 加封地\n" +
            "sfile:文件拖拽\n" +
            "writeOffAccountsPrice;销账金额\n" +
            "updated;是否修改 0 没有修改  1修改过了\n" +
            "dropBox;是否落箱 0没有落箱 1落箱了\n" +
            "withholding: 是否预提 0没有预提  1预提了\n" +
            "cash: 是否现金 0不是现金  1现金车\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "remark  备注\n" +
            "platRemark 平台备注\n" +
            "financeRemark 财务备注\n" +
            "payable 财务备注\n" +
            "financeRemark 财务备注\n" +
            "feeStateS 收款状态:已收款,已实收\n" +
            "feeStateF 付款状态:已付款,已实付\n" +
            "feeTotalS 总应收金额\n" +
            "feeTotalF 总应付金额\n" +
            "feeTotalSDiscount 货代开票为1时总应收金额*0.93\n" +
            "feeTotalFDiscount 车队开票为1时总应付金额*0.93\n" +
            "create_time datetime 创建时间\n" +
            "create_user varchar 创建人\n" +
            "update_time datetime 更新时间\n" +
            "update_user varchar 更新人\n",httpMethod = "POST")
    public JsonResult list2(PageResult2<T> page, Bill bill, HttpServletRequest request) throws Exception {
        return billService.list2(page, bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/list")
    @ApiOperation(value = "表格订单列表",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "customer  货代名称\n" +
            "contacts  联系人\n" +
            "billOfLading  提单号\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "boxNum  箱号\n" +
            "factoryAddress  工厂地址\n" +
            "arrivalPort  进港码头\n" +
            "whiteCard  白卡号\n" +
            "province  地址查询\n" +
            "dropBox;是否落箱 0没有落箱 1落箱了\n" +
            "withholding: 是否预提 0没有预提  1预提了\n" +
            "cash: 是否现金 0不是现金  1现金车\n" +
            "salesman;业务员\n" +
            "operater;操作\n" +
            "state  状态  参数传 '进行中' 返回'已做单','已指派车队','已提箱','已到厂','已离厂','已进港'的订单\n" +
            "参数传 '结算' 返回'发起费用清单','应付费用已审核','应收费用审核','财务应收应付费用已审核','结单'的订单\n" +
            "其他正常传值\n" +
            "feeTotalS  参数传: 'List_some_state' 这个值就可以得到keywords之后状态的订单\n" +
            "keywords  参数传: 订单某个开始状态:发起费用清单,货代费用已审核等等\n" +
            "feeTotalF  参数传: 不在流程的某个状态 比如待发起账单传:发起费用清单 返回结果为 没有'发起费用清单'这个状态的运单 \n" +
            "checked  未收款:运单还没有收款单 \n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            "sort  值为customer_id时 先以客户名称排序,再以装箱时间排序\n" +
            " \n\n\n" +
            "返回的结果:\n" +
            "id int id\n" +
            "organization_id varchar 组织id\n" +
            "customerId varchar 货代名称id\n" +
            "customer varchar 货代名称\n" +
            "email varchar email\n" +
            "contacts varchar 联系人\n" +
            "contacts_phone varchar 联系电话\n" +
            "dock varchar 码头\n" +
            "province varchar 模糊地址\n" +
            "address varchar 详细地址\n" +
            "weight varchar 箱门重量\n" +
            "box_type varchar 箱型\n" +
            "price varchar 价格\n" +
            "barcodeEffectiveDate varchar 最晚提箱时间/条码有效时间\n" +
            "earliestArrivalPortDate varchar 最早进港时间\n" +
            "pack_date varchar 装箱日期(货代要求的装箱时间)\n" +
            "vessel varchar 船名\n" +
            "voyage varchar 航次\n" +
            "whiteCard varchar 白卡号\n" +
            "bill_of_lading varchar 提单号\n" +
            "factory_address varchar 工厂地址\n" +
            "factory_phone varchar 装箱人电话\n" +
            "qr_code varchar 二维码\n" +
            "car_team varchar 车队\n" +
            "driverId 司机id\n" +
            "driver varchar 司机\n" +
            "driver_phone varchar 司机电话\n" +
            "sysDriverFreight varchar 系统司机运费\n" +
            "car_no varchar 车牌\n" +
            "driver_freight varchar 运费\n" +
            "box_num varchar 箱号\n" +
            "box_num_pic varchar 箱号图片\n" +
            "sealno varchar 封号\n" +
            "sealno_pic varchar 封号图片\n" +
            "arrived_factory_latitude varchar 到厂纬度\n" +
            "arrived_factory_longitude varchar 到厂经度\n" +
            "arrived_factory_date varchar 到厂时间\n" +
            "arrived_factory_warn_date varchar 到厂预警时间(默认提前一小时)\n" +
            "leaved_factory_date varchar 离厂时间\n" +
            "leaved_factory_longitude varchar 离厂经度\n" +
            "leaved_factory_latitude varchar 离厂纬度\n" +
            "arrived_harbour_date varchar 到港时间\n" +
            "arrived_harbour_latitude varchar 到港纬度\n" +
            "arrived_harbour_longitude varchar 到港经度\n" +
            "arrived_harbour_warn_date varchar 到港预警时间(默认提前一小时)\n" +
            "annex 附件\n" +
            "annexList 附件 没有实际用处\n" +
            "state varchar 状态:已下单,平台已接单,已做单,已提箱,已到厂,已离厂,已进港,发起费用清单,司机费用已审核,货代费用已提交,货代费用已审核,货代费用未通过,货代费用已提交,货代费用未通过,货代费用已审核,结单\n" +
            "carState;车辆状态:出行中,待出行 这几个状态的订单为出行中:已指派车队,已做单,已提箱,已到厂,已离厂,已进港\n" +
            "offertime:下单时间\n" +
            "maketime:做单时间\n" +
            "driverreceivetime:司机接单时间\n" +
            "upboxtime:提箱时间\n" +
            "arrivedfactorytime:到厂时间\n" +
            "leavefactorytime:离场时间\n" +
            "inporttime:进港时间\n" +
            "costbilltime:发起费用清单时间\n" +
            "verifytime:货代费用审核时间\n" +
            "driverFeeVerifytime:司机费用审核时间\n" +
            "customerverifytime:货代确认时间\n" +
            "upYard:提箱堆场\n" +
            "backYard:还箱堆场\n" +
            "billFeeList:费用信息\n" +
            "billProcessList:费用流程\n" +
            "arrivalPort:进港码头\n" +
            "sealedLand 加封地\n" +
            "sfile:文件拖拽\n" +
            "writeOffAccountsPrice;销账金额\n" +
            "updated;是否修改 0 没有修改  1修改过了\n" +
            "dropBox;是否落箱 0没有落箱 1落箱了\n" +
            "withholding: 是否预提 0没有预提  1预提了\n" +
            "cash: 是否现金 0不是现金  1现金车\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "remark  备注\n" +
            "platRemark 平台备注\n" +
            "financeRemark 财务备注\n" +
            "payable 财务备注\n" +
            "financeRemark 财务备注\n" +
            "feeStateS 收款状态:已收款,已实收\n" +
            "feeStateF 付款状态:已付款,已实付\n" +
            "feeTotalS 总应收金额\n" +
            "feeTotalF 总应付金额\n" +
            "feeTotalSDiscount 货代开票为1时总应收金额*0.93\n" +
            "feeTotalFDiscount 车队开票为1时总应付金额*0.93\n" +
            "create_time datetime 创建时间\n" +
            "create_user varchar 创建人\n" +
            "update_time datetime 更新时间\n" +
            "update_user varchar 更新人\n",httpMethod = "POST")
    public JsonResult list(PageResult2<T> page, Bill bill, HttpServletRequest request) throws Exception {
        return billService.list(page, bill, getLoginUser());
    }


    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listOpen")
    @ApiOperation(value = "订单展开查询",notes = "" +
            "id:运单id\n" +
            "\n",httpMethod = "POST")
    public JsonResult listOpen(Bill bill, HttpServletRequest request) {
        return billService.listOpen(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listDel")
    @ApiOperation(value = "表格订单列表",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "customer:客户\n" +
            "billOfLading:提单号\n" +
            "\n",httpMethod = "POST")
    public JsonResult listDel(PageResult2<T> page, Bill bill, HttpServletRequest request) throws Exception {
        return billService.listDel(page, bill, getLoginUser());
    }

    /*@PreAuthorize("hasAuthority('orderB:bill:list')")
    @GetMapping("/exportsFinance")
    @ApiOperation(value = "导出财务报表",notes = "" +
            "limit: 1000\n" +
            "page: 1\n" +
            "state: 应收费用已审核\n" +
            "date1: 2021-01-29 00:00:00\n" +
            "date2: 2021-01-30 23:59:59\n" +
            "billOfLading: 123\n" +
            "qrCode: financeList\n" +
            "carTeam: 车队\n" +
            "customer: 凯达 \n" +
            "",httpMethod = "POST")
    public void exportsFinance(PageResult2<T> page, Bill bill, HttpServletRequest request, HttpServletResponse response) throws Exception{
        //https://hutool.cn/docs/#/poi/Excel%E7%94%9F%E6%88%90-ExcelWriter
        bill.setDate1(bill.getDate1().substring(0,10)+" 00:00:00");
        if(Utils.isNotEmpty(bill.getDate2())){
            bill.setDate2(bill.getDate2().substring(0,10)+" 23:59:59");
        }
        JsonResult jr = billService.list(page,bill,getLoginUser());
        billService.exportsFinance(jr, bill);
        //http://localhost:9331/api/nt/bill/exportsFinance
        FileUploadUtil.download("finance.xlsx", response);
    }*/

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/financeList")
    @ApiOperation(value = "财务列表",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "customerId varchar 货代名称id\n" +
            "customer  货代名称\n" +
            "billOfLading  提单号\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "salesman;业务员\n" +
            "operater;操作\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            " \n\n\n" +
            "返回的结果:\n" +
            "id int id\n" +
            "customer varchar 货代名称\n" +
            "pack_date varchar 装箱日期(货代要求的装箱时间)\n" +
            "bill_of_lading varchar 提单号\n" +
            "car_team varchar 车队\n" +
            "driver varchar 司机\n" +
            "box_num varchar 箱号\n" +
            "sealno varchar 封号\n" +
            "state varchar 状态:已下单,平台已接单,已做单,已提箱,已到厂,已离厂,已进港,发起费用清单,司机费用已审核,货代费用已提交,货代费用已审核,货代费用未通过,货代费用已提交,货代费用未通过,货代费用已审核,结单\n" +
            "feeState:费用状态:已收款,已到账\n" +
            "upYard:提箱堆场\n" +
            "backYard:还箱堆场\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "financeRemark 财务备注\n" +
            "billFeeVoList:{currency:币种,type: 类型 应收应付, total 总金额, totalNoTax:不含税总金额}\n" +
            "",httpMethod = "POST")
    public JsonResult financeList(PageResult2<T> page, Bill bill, HttpServletRequest request) throws Exception {
        return billService.financeList(page, bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listAll")
    @ApiOperation(value = "订单列表",notes = "" +
            "customer  货代名称\n" +
            "contacts  联系人\n" +
            "billOfLading  提单号\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "boxNum  箱号\n" +
            "factoryAddress  工厂地址\n" +
            "arrivalPort  进港码头\n" +
            "whiteCard  白卡号\n" +
            "province  地址查询\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "state  状态\n" +
            "司机当前可接单列表:当state为已做单,driverPhone为司机手机号为接单人\n" +
            //"司机当前已经接单列表:当state为已接单,driverPhone为司机手机号为接单人\n" +
            "",httpMethod = "POST")
    public JsonResult listAll(Bill bill, HttpServletRequest request) throws Exception {
        return billService.list(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listUnExamine")
    @ApiOperation(value = "订单列表",notes = "" +
            "customer  货代名称\n" +
            "contacts  联系人\n" +
            "billOfLading  提单号\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "boxNum  箱号\n" +
            "factoryAddress  工厂地址\n" +
            "arrivalPort  进港码头\n" +
            "whiteCard  白卡号\n" +
            "province  地址查询\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "state  状态\n" +
            "司机当前可接单列表:当state为已做单,driverPhone为司机手机号为接单人\n" +
            "",httpMethod = "POST")
    public JsonResult listUnExamine(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listUnExamine();
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listNum")
    @ApiOperation(value = "没时间区间订单列表返回条数",notes = "" +
            "customer  货代名称\n" +
            "contacts  联系人\n" +
            "billOfLading  提单号\n" +
            "carTeam 车队\n" +
            "carNo  车牌\n" +
            "boxNum  箱号\n" +
            "factoryAddress  工厂地址\n" +
            "arrivalPort  进港码头\n" +
            "whiteCard  白卡号\n" +
            "province  地址查询\n" +
            "salesman;业务员\n" +
            "operater;操作\n" +
            "state  状态\n" +
            "feeTotalS  参数传: 'List_some_state' 这个值就可以得到keywords之后状态的订单\n" +
            "keywords  参数传1: 订单某个开始状态:发起费用清单,货代费用已审核登登\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            "返回的结果:\n" +
            "num 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listDayNum")
    @ApiOperation(value = "返回每天订单条数",notes = "" +
            "customer  货代名称\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 00:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 23:59:59\n" +
            "返回的结果:\n" +
            "num 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listDayNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listDayNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listWeekNum")
    @ApiOperation(value = "返回每周订单条数",notes = "" +
            "customer  填1 就表示要返回货代名称\n" +
            "contacts  客户名称\n" +
            "carNo  填1 就表示要返回司机名字\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 00:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 23:59:59\n" +
            "返回的结果:\n" +
            "num 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listWeekNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listWeekNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listMonthNum")
    @ApiOperation(value = "返回每月订单条数",notes = "" +
            "customer  填1 就表示要返回货代字段 具体的客户就返回单个客户的数量 \n" +
            "date1  做箱(pack_date)开始时间 填2020-10-01\n" +
            "返回的结果:\n" +
            "num 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listMonthNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listMonthNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listMonthCustomerAndDriverNum")
    @ApiOperation(value = "返回每月订单客户或者司机条数",notes = "" +
            "customer  填1 就表示要返回货代字段\n" +
            "carNo  填1 就表示要返回货代字段\n" +
            "date1  做箱(pack_date)开始时间 填2020-10-01\n" +
            "返回的结果:\n" +
            "nums 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listMonthCustomerAndDriverNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listMonthCustomerAndDriverNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listUnPayNum")
    @ApiOperation(value = "返回客户未付款订单条数",notes = "" +
            "customer 货代名称\n" +
            "feeStateS  未收款\n" +
            "返回的结果:\n" +
            "nums 数量\n" +
            "",httpMethod = "POST")
    public JsonResult listUnPayNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listUnPayNum(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/listDockNum")
    @ApiOperation(value = "本周本月热门门点",notes = "" +
            "dock  week  本周排行\n" +
            "dock  month  本月排行\n" +
            "dock  last month  上月排行\n" +
            "dock  quarter  本季排行\n" +
            "dock  last quarter  上季排行\n" +
            "dock  customer  返回客户,需要填下面的customer和具体的客户名称\n" +
            "customer  具体的客户名称\n" +
            "返回的结果:\n" +
            "customer 口岸\n" +
            "carNo 地址\n" +
            "num 数量\n" +
            "boxType 箱型\n" +
            "price 价格n" +
            "",httpMethod = "POST")
    public JsonResult listDockNum(Bill bill, HttpServletRequest request) throws Exception {
        return billService.listDockNum(bill, getLoginUser());
    }


    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/calendarBillNum")
    @ApiOperation(value = "日历返回订单数量",notes = "" +
            "customer  客户\n" +
            "driverPhone  司机电话\n" +
            "carTeamId  车队id\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            "返回的结果:\n" +
            "boxNum 数量\n" +
            "pack_date varchar 装箱日期(货代要求的装箱时间)\n" +
            "",httpMethod = "POST")
    public JsonResult calendarBillNum(Bill bill, HttpServletRequest request) throws Exception {
        return JsonResult.ok().setData(billService.calendarBillNum(bill, getLoginUser()));
    }


    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/getById")
    @ApiOperation(value = "订单查询",notes = "id ",httpMethod = "POST")
    public JsonResult getById(Bill bill, HttpServletRequest request) {
        return JsonResult.ok().setData(billService.getById(bill));
    }

    @PostMapping("/feerun")
    public void feerun(Bill bill, HttpServletRequest request) {
        billService.feerun();
    }

//    @PostMapping("/save")
//    @ApiOperation(value = "订单添加",notes = "id ",httpMethod = "POST")
//
//    public JsonResult save(Bill bill, HttpServletRequest request) {
//        operRecordService.saveAsync(new OperRecord(Integer.valueOf(getLoginUserId(request)), "订单添加", "订单修改",
//                request.getServletPath(), "POST", "ApiBillController.save", request.getQueryString(),//JSONObject.toJSON(bill).toString(),
//                "", getIpAddress(request)));
//        return billService.save(bill, getLoginUser());
//    }

    @PreAuthorize("hasAuthority('orderB:bill:copyBill')")
    @PostMapping("/copyBill")
    @ApiOperation(value = "复制订单 1",notes = "" +
            "id:订单id 必填\n" +
            "",httpMethod = "POST")
    public JsonResult copyBill(Bill bill, HttpServletRequest request) {
        return billService.copyBill(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:offer')")
    @OperLog(value = "订单管理", desc = "货代下单", result = true)
    @PostMapping("/offer")
    @ApiOperation(value = "货代下单 1",notes = "" +
            "oceanId 海运id\n" +
            "customerId varchar 货代名称id 必填\n" +
            "customer:货代名称 必填\n" +
//            "contacts:联系人 必填\n" +
//            "contactsPhone:联系电话 必填\n" +
            "dock:码头A 必填\n" +
            "province:模糊的地址 必填\n" +
            "address:具体地址\n" +
            "weight:重量 必填\n" +
            "boxType:箱型 必填\n" +
            "price:报价 必填\n" +
            "driverFreight  运费 必填\n" +
            "sysDriverFreight  系统司机运费参考 必填\n" +
            "packDate:装箱日期(货代要求的装箱时间) 必填\n" +
            "vessel:船名 必填\n" +
            "voyage:航次 必填\n" +
            "efFactoryAddress:电子围栏工厂地址  不填的时候就要新增,传了直接保存这个id \n" +
            "efYard:电子围栏堆场\n" +
            "efDock:电子围栏港口码头\n" +
            "billOfLading:提单号 必填\n" +
            "barcodeEffectiveDate varchar 最晚提箱时间/条码有效时间\n" +
            "earliestArrivalPortDate varchar 最早进港时间\n" +
            "factoryAddress:工厂地址 必填\n" +
            "factoryPhone:装箱人电话\n" +
            "arrivedFactoryWarnDate varchar 到厂预警时间(默认提前二小时) 必填\n" +
            "arrivedHarbourWarnDate varchar 到港预警时间(默认提前二小时) 必填\n" +
            "annex:附件\n" +
            "qrCode:二维码\n" +
            "remark:备注\n" +
            "sfile:文件拖拽\n" +
            "\n\n工厂地址电子围栏  \n\n" +
            "addressId:货代费用地址id 必填\n" +
            "faddress:地址\n" +
            "fphone:电话\n" +
            "fstate:默认\n" +
            "longitude:经度\n" +
            "latitude:纬度\n" +
            "radius:半径\n" +
            "ftype:类型:address,maintainFee  从searchAddressFee方法会得到一个type放到这里\n" +
            "maintainFeeId: maintainFee表的 id  地址选择好后如果是maintainFee类型的 需要手动添加\n" +
            "{\"customerId\":\"164\",\"customer\":\"凯达\",\"dock\":\"码头B\",\"weight\":\"11.3\"," +
            "\"boxType\":\"40GP\",\"packDate\":\"2020-09-28 06:11:23\",\"vessel\":\"远洋\",\"voyage\":\"A-1\"," +
            "\"billOfLading\":\"1111\",\"annex\":\"annex111\",\"remark\":\"111\"," +
            "\"addressFactoryList\":[{\"customerId\":\"164\",\"faddress\":\"3\",\"fphone\":\"4\"," +
            "\"fremark\":\"6\",\"longitude\":\"7\",\"latitude\":\"8\",\"radius\":\"9\"}]}\n" +
            "",httpMethod = "POST")
    public JsonResult offer(@RequestBody Bill bill, HttpServletRequest request) {
        try{
            return billService.order(bill, getLoginUser());
        } catch (IndexOutOfBoundsException e) {
            return JsonResult.error("没有客户");
        }
    }

    @PreAuthorize("hasAuthority('orderB:bill:platReceive')")
    @OperLog(value = "订单管理", desc = "平台接单", result = true)
    @PostMapping("/platReceive")
    @ApiOperation(value = "平台接单 2",notes = "" +
            "id: billid \n" +
            "dock:码头A \n" +
            "province:模糊的地址 \n" +
            "address:具体地址\n" +
            "weight:重量 \n" +
            "boxType:箱型 \n" +
            "price:报价 \n" +
            "driverFreight  运费 \n" +
            "sysDriverFreight  系统司机运费参考 \n" +
            "packDate:装箱日期(货代要求的装箱时间) \n" +
            "vessel:船名 \n" +
            "voyage:航次 \n" +
            "billOfLading:提单号 \n" +
            "factoryAddress:工厂地址 \n" +
            "factoryPhone:装箱人电话\n" +
            "barcodeEffectiveDate varchar 最晚提箱时间/条码有效时间\n" +
            "earliestArrivalPortDate varchar 最早进港时间\n" +
            "efFactoryAddress:电子围栏工厂地址  不填的时候就要新增,传了直接保存这个id \n" +
            "efYard:电子围栏堆场\n" +
            "efDock:电子围栏港口码头\n" +
            "sealedLand 加封地\n" +
            "annex:附件\n" +
            "{\"id\":\"5149\",\"dock\":\"码头B11\",\"weight\":\"11.3\",\"boxType\":\"40GP\"," +
            "\"packDate\":\"2020-09-28 06:11:23\",\"vessel\":\"远洋\",\"voyage\":\"A-1\"," +
            "\"billOfLading\":\"1111\",\"annex\":\"anne11111x111\",\"efYard\":\"1,2,3\"," +
            "\"efDock\":\"7\",\"sealedLand\":\"加封地\",\"addressFactoryList\":[{\"billId\":\"5149\",\"customerId\":\"2\"," +
            "\"faddress\":\"22223\",\"fphone\":\"4\",\"longitude\":\"7\",\"latitude\":\"8\"," +
            "\"radius\":\"9\"},{\"billId\":\"5149\",\"customerId\":\"2\",\"faddress\":\"22223\"," +
            "\"fphone\":\"4\",\"longitude\":\"7\",\"latitude\":\"8\",\"radius\":\"9\"}]}\n" +
            "",httpMethod = "POST")
    public JsonResult platReceive(@RequestBody Bill bill, HttpServletRequest request) {
        return billService.platReceive(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:make')")
    @OperLog(value = "订单管理", desc = "指派车队接单", result = true)
    @PostMapping("/carTeam")
    @ApiOperation(value = "指派车队接单 3",notes = "" +
            "id 必填\n" +
            "carTeamId 车队id 必填\n" +
            "carTeam varchar 车队必填\n" +
            "efYard:电子围栏堆场\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult carTeam(Bill bill, HttpServletRequest request) {
        return billService.carTeam(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:make')")
    @OperLog(value = "订单管理", desc = "做单", result = true)
    @PostMapping("/make")
    @ApiOperation(value = "做单 4",notes = "" +
            "id \n" +
            "carTeamId 车队id (指派过车队的就不需要填写了)\n" +
            "carTeam varchar 车队(指派过车队的就不需要填写了)\n" +
            "carNo varchar 车牌\n" +
            "driverId 司机id 必填\n" +
            "driver varchar 司机 必填\n" +
            "driverPhone varchar 司机电话\n" +
            "driverFreight varchar 运费 必填\n" +
            "whiteCard varchar 白卡号 \n" +
            "efYard:电子围栏堆场\n" +
//            "remark:备注\n" +
            "sfile:文件拖拽\n" +
            "",httpMethod = "POST")
    public JsonResult make(Bill bill, HttpServletRequest request) {
        return billService.make(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:upBox')")
    @OperLog(value = "订单管理", desc = "提箱", result = true)
    @PostMapping("/upBox_substitute")
    @ApiOperation(value = "提箱 补录箱封号 4",notes = "" +
            "id \n" +
            "boxNum varchar 箱号 必填\n" +
            "boxNumPic varchar 箱号图片 必填\n" +
            "sealno varchar 封号 必填\n" +
            "sealnoPic varchar 封号图片 必填\n" +
//            "arrivalPort:进港码头\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult upBox_substitute(Bill bill, HttpServletRequest request) {
        return billService.upBox_substitute(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:upBox')")
    @OperLog(value = "订单管理", desc = "提箱", result = true)
    @PostMapping("/upBox")
    @ApiOperation(value = "提箱 4",notes = "" +
            "id \n" +
            "boxNum varchar 箱号 必填\n" +
            "boxNumPic varchar 箱号图片 必填\n" +
            "sealno varchar 封号 必填\n" +
            "sealnoPic varchar 封号图片 必填\n" +
            "arrivalPort:进港码头\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult upBox(Bill bill, HttpServletRequest request) {
        return billService.upBox(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:arrivedFactory')")
    @OperLog(value = "订单管理", desc = "到厂", result = true)
    @PostMapping("/arrivedFactory")
    @ApiOperation(value = "到厂 5",notes = "" +
            "id \n" +
            "arrivedFactoryLatitude varchar 到厂纬度 必填\n" +
            "arrivedFactoryLongitude varchar 到厂经度 必填\n" +
            "arrivedFactoryDate varchar 到厂时间 必填\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult arrivedFactory(Bill bill, HttpServletRequest request) {
        return billService.arrivedFactory(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:leaveFactory')")
    @OperLog(value = "订单管理", desc = "离厂", result = true)
    @PostMapping("/leaveFactory")
    @ApiOperation(value = "离厂 6",notes = "" +
            "id \n" +
            "leavedFactoryDate varchar 离厂时间 必填\n" +
            "leavedFactoryLongitude varchar 离厂经度 必填\n" +
            "leavedFactoryLatitude varchar 离厂纬度 必填\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult leaveFactory(Bill bill, HttpServletRequest request) {
        return billService.leaveFactory(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:inPort')")
    @OperLog(value = "订单管理", desc = "预录入照片", result = true)
    @PostMapping("/inPort_substitute")
    @ApiOperation(value = "进港  7",notes = "" +
            "id \n" +
            "preEntryPic varchar 预录入照片 必填\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult inPort_substitute(Bill bill, HttpServletRequest request) {
        return billService.inPort_substitute(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:inPort')")
    @OperLog(value = "订单管理", desc = "进港", result = true)
    @PostMapping("/inPort")
    @ApiOperation(value = "进港  7",notes = "" +
            "id \n" +
            "arrivedHarbourDate varchar 到港时间 必填\n" +
            "arrivedHarbourLatitude varchar 到港纬度 必填\n" +
            "arrivedHarbourLongitude varchar 到港经度 必填\n" +
            "preEntryPic varchar 预录入照片 必填\n" +
//            "remark:备注\n" +
            "",httpMethod = "POST")
    public JsonResult inPort(Bill bill, HttpServletRequest request) {
        return billService.inPort(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:costBill')")
    @OperLog(value = "订单管理", desc = "发起费用清单", result = true)
    @PostMapping("/costBill")
    @ApiOperation(value = "发起费用清单 8",notes = "" +
            "id \n" +
//            "platRemark:备注\n" +
            "fobject 费用对象 货代,司机,码头\n" +
            "\n" +
            "例子:{\"id\":\"145\",,\"billFeeList\":[{\"billId\":145, \"type\":\"类型3\",\"feeModules\":\"模块\",\"fobject\":\"货代\",\"boxType\":\"箱型\", \"feeName\":\"费用名称3\", \"standard\":\"标准\", \"price\":\"金额3\", \"remark\":\"备注3\"},{\"billId\":145, \"type\":\"类型4\",\"feeModules\":\"模块\",\"fobject\":\"货代\",\"boxType\":\"箱型\", \"feeName\":\"费用名称4\", \"standard\":\"标准\", \"price\":\"金额4\", \"remark\":\"备注4\"}]}\n" +
            "",httpMethod = "POST")
    public JsonResult costBill(@RequestBody Bill bill, HttpServletRequest request)throws Exception {
        try {
            return billService.costBill(bill, getLoginUser());
        } catch (Exception e) {
            e.printStackTrace();
            return JsonResult.error("请填写订单id,操作失败!");
        }
    }


    @PreAuthorize("hasAuthority('orderB:bill:costBill')")
    @OperLog(value = "订单管理", desc = "发起费用清单", result = true)
    @PostMapping("/directCostBill")
    @ApiOperation(value = "直接发起费用清单 8",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult directCostBill(Bill bill, HttpServletRequest request)throws Exception {
        try {
            return billService.directCostBill(bill, getLoginUser());
        } catch (Exception e) {
            e.printStackTrace();
            return JsonResult.error("请填写订单id,操作失败!");
        }
    }

    @PreAuthorize("hasAuthority('orderB:bill:driverFeeVerify')")
    @OperLog(value = "订单管理", desc = "应付费用审核", result = true)
    @PostMapping("/payableVerify")
    @ApiOperation(value = "应付费用审核 9 ",notes = "" +
            "id: bill id\n" +
            "",httpMethod = "POST")
    public JsonResult payableVerify(Bill bill, HttpServletRequest request) {
        return billService.payableVerify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:driverFeeVerify')")
    @OperLog(value = "订单管理", desc = "应收费用审核", result = true)
    @PostMapping("/receivableVerify")
    @ApiOperation(value = "应收费用审核 10",notes = "" +
            "id: bill id \n" +
            "",httpMethod = "POST")
    public JsonResult receivableVerify(Bill bill, HttpServletRequest request) {
        return billService.receivableVerify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:driverFeeVerify')")
    @OperLog(value = "订单管理", desc = "财务应收应付费用审核", result = true)
    @PostMapping("/receivablePayableVerify")
    @ApiOperation(value = "财务应收应付费用审核 11",notes = "" +
            "id: bill id多个传值形式: 1,2,3 \n" +
            "",httpMethod = "POST")
    public JsonResult receivablePayableVerify(Bill bill, HttpServletRequest request) {
        return billService.receivablePayableVerify(bill, getLoginUser());
    }

    /*@PreAuthorize("hasAuthority('orderB:bill:driverFeeVerify')")
    @OperLog(value = "订单管理", desc = "")
    @PostMapping("/driverFeeFleetVerify")
    @ApiOperation(value = "司机费用车队审核 9并列",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult driverFeeFleetVerify(Bill bill, HttpServletRequest request) {
        return billService.driverFeeFleetVerify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:driverFeeVerify')")
    @OperLog(value = "订单管理", desc = "")
    @PostMapping("/driverFeePlatVerify")
    @ApiOperation(value = "司机费用平台审核 10并列",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult driverFeePlatVerify(Bill bill, HttpServletRequest request) {
        return billService.driverFeePlatVerify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:verify')")
    @OperLog(value = "订单管理", desc = "")
    @PostMapping("/verify")
    @ApiOperation(value = "货代费用提交 9并列",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult verify(Bill bill, HttpServletRequest request) {
        return billService.verify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:customerVerify')")
    @OperLog(value = "订单管理", desc = "")
    @PostMapping("/customerVerify")
    @ApiOperation(value = "货代费用审核 10并列",notes = "" +
            "id \n" +
            "\n" +
            "",httpMethod = "POST")
    public JsonResult customerVerify(Bill bill, HttpServletRequest request) {
        return billService.customerVerify(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:customerDisagree')")
    @OperLog(value = "订单管理", desc = "")
    @PostMapping("/customerDisagree")
    @ApiOperation(value = "货代费用未通过 10并列",notes = "" +
            "id \n" +
            "feeRemark:费用驳回的备注\n" +
            "",httpMethod = "POST")
    public JsonResult customerDisagree(Bill bill, HttpServletRequest request) {
        return billService.customerDisagree(bill, getLoginUser());
    }*/

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "修改订单", result = true)
    @PostMapping("/update")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "customerId varchar 货代名称id 必填\n" +
            "customer:货代名称 必填\n" +
            "contacts:联系人 必填\n" +
            "contactsPhone:联系电话 必填\n" +
            "dock:码头 必填\n" +
            "province:模糊地址  必填\n" +
            "address:详细地址\n" +
            "weight:箱门重量 必填\n" +
            "boxType:箱型 必填\n" +
            "price:价格 必填\n" +
            "packDate:装箱日期(货代要求的装箱时间) 必填\n" +
            "vessel:船名 必填\n" +
            "voyage:航次 必填\n" +
            "barcodeEffectiveDate varchar 最晚提箱时间/条码有效时间\n" +
            "earliestArrivalPortDate varchar 最早进港时间\n" +
            "billOfLading:提单号 必填\n" +
            "factoryAddress:工厂地址 必填\n" +
            "factoryPhone:装箱人电话\n" +
            "qrCode:二维码\n" +
            "carTeam:车队\n" +
            "driverId:司机id\n" +
            "driver:司机\n" +
            "driverPhone:司机电话\n" +
            "carNo:车牌\n" +
            "driver_freight:运费\n" +
            "boxNum:箱号\n" +
            "boxNumPic:箱号图片\n" +
            "sealno:封号\n" +
            "sealnoPic:封号图片\n" +
            "arrivedFactoryLatitude:到厂纬度\n" +
            "arrivedFactoryLongitude:到厂经度\n" +
            "arrivedFactoryDate:到厂时间\n" +
            "arrivedFactoryWarnDate:到厂预警时间(默认提前一小时)\n" +
            "leavedFactoryDate:离厂时间\n" +
            "leavedFactoryLongitude:离厂经度\n" +
            "leavedFactoryLatitude:离厂纬度\n" +
            "arrivedHarbourDate:到港时间\n" +
            "arrivedHarbourLatitude:到港纬度\n" +
            "arrivedHarbourLongitude:到港经度\n" +
            "arrivedHarbourWarnDate:到港预警时间(默认提前一小时)\n" +
            "preEntryPic:预录入照片\n" +
            "upYard:提箱堆场\n" +
            "backYard:还箱堆场\n" +
            "arrivalPort:进港码头\n" +
            "sfile 文件拖拽\n" +
            "whiteCard:白卡号\n" +
            "sealedLand 加封地\n" +
            "annex 附件\n" +
            "salesmanId;业务员id\n" +
            "salesman;业务员\n" +
            "operaterId;操作id\n" +
            "operater;操作\n" +
            "remark:客户备注\n" +
            "platRemark:平台备注\n" +
            "efFactoryAddress:电子围栏工厂地址\n" +
            "efYard:电子围栏堆场\n" +
            "efDock:电子围栏港口码头\n" +
//            "ftype:类型:address,maintainFee  从searchAddressFee方法会得到一个type放到这里\n" +
//            "maintainFeeId: maintainFee表的 id  地址选择好后如果是maintainFee类型的 需要手动添加\n" +
            "{\"id\":\"2971\",\"customerId varchar 货代名称id 必填\",\"customer\":\"货代名称 必填\",\"contacts\":\"联系人 必填\"," +
            "\"contactsPhone\":\"联系电话 必填\",\"dock\":\"码头 必填\",\"province\":\"模糊地址  必填\",\"address\":\"详细地址\",\"weight\":\"箱门重量 必填\"," +
            "\"boxType\":\"箱型 必填\",\"price\":\"价格 必填\",\"packDate\":\"装箱日期(货代要求的装箱时间) 必填\",\"vessel\":\"船名 必填\",\"voyage\":\"航次 必填\"," +
            "\"billOfLading\":\"提单号 必填\",\"factoryAddress\":\"工厂地址 必填\",\"factoryPhone\":\"装箱人电话\",\"qrCode\":\"二维码\",\"carTeam\":\"车队\"," +
            "\"driver\":\"司机\",\"driverPhone\":\"司机电话\",\"carNo\":\"车牌\",\"driver_freight\":\"运费\",\"boxNum\":\"箱号\",\"boxNumPic\":\"箱号图片\"," +
            "\"sealno\":\"封号\",\"sealnoPic\":\"封号图片\",\"arrivedFactoryLatitude\":\"到厂纬度\",\"arrivedFactoryLongitude\":\"到厂经度\"," +
            "\"arrivedFactoryDate\":\"到厂时间\",\"arrivedFactoryWarnDate\":\"到厂预警时间(默认提前一小时)\",\"leavedFactoryDate\":\"离厂时间\"," +
            "\"leavedFactoryLongitude\":\"离厂经度\",\"leavedFactoryLatitude\":\"离厂纬度\",\"arrivedHarbourDate\":\"到港时间\"," +
            "\"arrivedHarbourLatitude\":\"到港纬度\",\"arrivedHarbourLongitude\":\"到港经度\",\"arrivedHarbourWarnDate\":\"到港预警时间(默认提前一小时)\"," +
            "\"preEntryPic\":\"预录入照片\",\"upYard\":\"提箱堆场\",\"backYard\":\"还箱堆场\",\"arrivalPort\":\"进港码头\",\"sfile 文件拖拽\",\"whiteCard\":\"白卡号\"," +
            "\"sealedLand\":\"加封底3\"," +
            "\"annex 附件\",\"salesmanId;业务员id\",\"salesman;业务员\",\"operaterId;操作id\",\"operater;操作\",\"remark\":\"客户备注\",\"platRemark\":\"平台备注\"," +
            "\"efFactoryAddress\":\"电子围栏工厂地址\",\"efYard\":\"电子围栏堆场\",\"efDock\":\"电子围栏港口码头\",\n" +
//            "\"addressFactoryList\":[{\"addressId\":\"1\",\"customerId\":\"2\",\"faddress\":\"3\",\"fphone\":\"4\",\"fstate\":\"5\",\"fremark\":\"6\"," +
//            "\"longitude\":\"7\",\"latitude\":\"8\",\"radius\":\"9\",\"ftype\":\"maintainFee\",\"maintainFeeId\":\"3201\"}]}\n" +
            "",httpMethod = "POST")
    public JsonResult update(@RequestBody Bill bill, HttpServletRequest request) {
        return billService.update(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "箱号图片上传", result = true)
    @PostMapping("/updateBoxNumPic")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "boxNumPic:箱号图片 必填 \n" +
            "",httpMethod = "POST")
    public JsonResult updateBoxNumPic(Bill bill, HttpServletRequest request) {
        return billService.updateBoxNumPic(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "备注修改", result = true)
    @PostMapping("/updateRemark")
    @ApiOperation(value = "备注修改",notes = "" +
            "id:id 必填\n" +
            "platRemark:甩手备注 必填 \n" +
            "remark: 客户备注 必填 \n" +
            "",httpMethod = "POST")
    public JsonResult updateRemark(Bill bill, HttpServletRequest request) {
        return billService.updateRemark(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "财务修改备注", result = true)
    @PostMapping("/updateFinance")
    @ApiOperation(value = "财务修改备注",notes = "" +
            "id:id 必填\n" +
            "financeRemark:财务备注 必填 \n" +
            "",httpMethod = "POST")
    public JsonResult updateFinance(Bill bill, HttpServletRequest request) {
        return billService.updateFinance(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "封号图片修改", result = true)
    @PostMapping("/updateSealnoPic")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "sealnoPic:封号图片 必填\n" +
            "",httpMethod = "POST")
    public JsonResult updateSealnoPic(Bill bill, HttpServletRequest request) {
        return billService.updateSealnoPic(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "预录入照片修改", result = true)
    @PostMapping("/updatePreEntryPic")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "preEntryPic:预录入照片 必填\n" +
            "",httpMethod = "POST")
    public JsonResult updatePreEntryPic(Bill bill, HttpServletRequest request) {
        return billService.updatePreEntryPic(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "附件修改", result = true)
    @PostMapping("/updateAnnex")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "annex 附件 必填\n" +
            "",httpMethod = "POST")
    public JsonResult updateAnnex(Bill bill, HttpServletRequest request) {
        return billService.updateAnnex(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "文件拖拽", result = true)
    @PostMapping("/updateSfile")
    @ApiOperation(value = "修改订单",notes = "" +
            "id:id 必填\n" +
            "sfile 文件拖拽 必填\n" +
            "",httpMethod = "POST")
    public JsonResult updateSfile(Bill bill, HttpServletRequest request) {
        return billService.updateSfile(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "取消订单", result = true)
    @PostMapping("/billCancel")
    @ApiOperation(value = "取消订单",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult billCancel(Bill bill, HttpServletRequest request) {
        return billService.billCancel(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "取消订单", result = true)
    @PostMapping("/billCancelCustomer")
    @ApiOperation(value = "客户取消订单, 接单以后不能取消",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult billCancelCustomer(Bill bill, HttpServletRequest request) {
        return billService.billCancelCustomer(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "订单恢复", result = true)
    @PostMapping("/billRecover")
    @ApiOperation(value = "订单恢复",notes = "" +
            "id \n" +
            "",httpMethod = "POST")
    public JsonResult billRecover(Bill bill, HttpServletRequest request) {
        return billService.billRecover(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "应收确认", result = true)
    @PostMapping("/receivable")
    @ApiOperation(value = "应收确认",notes = "" +
            "id bill表id\n" +
            "feeStateS 收款状态:已收款,已实收 必填\n" +
            "",httpMethod = "POST")
    public JsonResult receivable(Bill bill, HttpServletRequest request) {
        return billService.receivable(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "应付确认", result = true)
    @PostMapping("/payable")
    @ApiOperation(value = "应付确认",notes = "" +
            "id bill表id\n" +
            "feeStateF 付款状态:已付款,已实付 必填\n" +
            "",httpMethod = "POST")
    public JsonResult payable(Bill bill, HttpServletRequest request) {
        return billService.payable(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "是否落箱修改", result = true)
    @PostMapping("/changeDropBox")
    @ApiOperation(value = "是否落箱修改",notes = "" +
            "id bill表id\n" +
            "",httpMethod = "POST")
    public JsonResult changeDropBox(Bill bill, HttpServletRequest request) {
        return billService.changeDropBox(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "是否预提修改", result = true)
    @PostMapping("/changeWithholdingBox")
    @ApiOperation(value = "是否预提修改",notes = "" +
            "id bill表id\n" +
            "",httpMethod = "POST")
    public JsonResult changeWithholdingBox(Bill bill, HttpServletRequest request) {
        return billService.changeWithholdingBox(bill, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:bill:update')")
    @OperLog(value = "订单管理", desc = "是否预提修改", result = true)
    @PostMapping("/changeCash")
    @ApiOperation(value = "是否现金修改",notes = "" +
            "id bill表id\n" +
            "",httpMethod = "POST")
    public JsonResult changeCash(Bill bill, HttpServletRequest request) {
        return billService.changeCash(bill, getLoginUser());
    }


    @PreAuthorize("hasAuthority('orderB:bill:list')")
    @PostMapping("/writeOffAccountsList")
    @ApiOperation(value = "未销账单列表",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "invoicename  抬头\n" +
            "type  应收应付\n" +
            "billOfLading  提单号\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "writeOff 值为'writeOff' 返回销账列表 必填\n" +
            "writeOff 值为'unWriteOff' 返回已经销账列表 为了销账撤销使用 必填\n" +
            " \n\n\n" +
            "返回的结果:\n" +
            "id : bill id\n" +
            "invoicename  抬头\n" +
            "type  应收应付\n" +
            "billOfLading  提单号\n" +
            "boxNum  箱号\n" +
            "packDate  装箱时间\n" +
            "price  总金额\n" +
            "settlementPrice  修改金额\n" +
            "settlement  销账完成度:  0未销账 1部分 2全部\n" +
            "",httpMethod = "POST")
    public JsonResult writeOffAccountsList(PageResult2<T> page, WriteOff bill, HttpServletRequest request) throws Exception {
        return billService.writeOffAccountsList(page, bill, getLoginUser());
    }


}
